class Solution {
    public boolean isSubsequence(String s, String t) {
        int p1 = 0, p2 = 0;
        char[] c1 = s.toCharArray();
        char[] c2 = t.toCharArray();

        while (p1 < c1.length && p2 < c2.length) {
            if (c1[p1] == c2[p2]) {
                p1++;
                p2++;
            } else {
                p2++;
            }
        }
        return p1 == c1.length;
    }
}
